<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of ChangePasswordUcalpForm
 *
 * @author ivan
 */
class ChangePasswordUcalpForm extends sfForm
{

  public function configure()
  {

    $this->widgetSchema['password_old'] =  new sfWidgetFormInputPassword();
    $this->validatorSchema['password_old'] = new sfValidatorString(array('max_length' => 128));
    $this->validatorSchema['password_old']->setOption('required', true);

    $this->widgetSchema['password'] = new sfWidgetFormInputPassword();
    $this->validatorSchema['password'] = new sfValidatorString(array('max_length' => 128));
    $this->validatorSchema['password']->setOption('required', true);

    $this->widgetSchema['password_again'] = new sfWidgetFormInputPassword();
    $this->validatorSchema['password_again'] = clone $this->validatorSchema['password'];
    $this->widgetSchema->moveField('password_again', 'after', 'password');

    $this->mergePostValidator(new sfValidatorSchemaCompare('password', sfValidatorSchemaCompare::EQUAL, 'password_again', array(), array('invalid' => 'The two passwords must be the same.')));

  }
}
